//页面初始化
//注册
REGISTER = {};
REGISTER.is_load = false;

REGISTER.__INIT__ = function () {
    myApp_.hideNavbar('.navbar');
    myApp_.hideToolbar(".toolbar");
    mainView.router.load({
        url: 'src/index/login/register.html'
    });
    if (REGISTER.is_load == false) {
        REGISTER.is_load = true;
    }
}
//注册数据
REGISTER.data = {
    telephone: null
//	,phone_code: null
    , pwd1: null
    , pwd2: null
    , is_agree: false
}

//
REGISTER.assignment = function () {
    REGISTER.data.telephone = $("#telephone").val();
    REGISTER.data.pwd1 = $("#password1").val();
    REGISTER.data.pwd2 = $("#password2").val();
    REGISTER.data.is_agree = $("#member_service_checkbox").is(':checked');
}
REGISTER.submit = function () {
    REGISTER.assignment();
    if (!this.data.is_agree) {//同意协议方可注册
        return false;
    }
    if (this.data.pwd1 == this.data.pwd2) {
        this.data.password = this.data.pwd1;
    } else {
        my_tips_('您两次输入的密码不一致');
        return false;
    }
    if (!telephone) {
        my_tips_('请输入您的电话');
        return false;
    }


    request_(
        url_('index/User/register')
        , REGISTER.data
        , function (d) {
            if (d.code == 0) {
                my_tips_('注册成功', function () {
                    go_href_('#/');
                });
            } else {
                my_tips_(d.msg);
            }
        }
    );

}